package com.gaofeng.day05;

import java.util.Scanner;

public class demo03 {
    public static void main(String[] args) {
        //
        String username = "admin";
        String password = "123456";
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < 3; i++) {
            System.out.println("请输入用户名");
            String name = sc.next();
            System.out.println("请输入密码");
            String pwd = sc.next();


            //比较
            if(username.equals(name) && password.equals(pwd)){
                System.out.println("登录成功");
                break;
            }else{
                if( i == 2){
                    System.out.println("账号" + username + "已经被锁定,请联系官方客服");
                }else{
                    System.out.println("账户名密码错误,您还剩下"+(2 - i)+"次机会");
                }

            }
        }
    }
}
